package com.wenjh.jdmzt.android.activity;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.KeyEvent;

import com.wenjh.jdmzt.android.view.ActionBar;


public abstract class TabOptionFragment extends BaseFragment {
	private boolean inited = false;
	private boolean fristResume = false;
	private boolean callResumeAfterCreated = false;
	
	public void onFristResume() {
		fristResume = true;
	}
	
	public boolean isFristResumed() {
		return fristResume;
	}
	
	public void setCallResumeAfterCreated(boolean callResumeAfterCreated) {
		this.callResumeAfterCreated = callResumeAfterCreated;
	}
	
	public boolean isCallResumeAfterCreated() {
		return callResumeAfterCreated;
	}
	
	@Override
	public void onActivityCreated(Bundle savedInstanceState) {
		if(savedInstanceState != null) {
			callSuperActivityCreated(savedInstanceState);
		} else {
			super.onActivityCreated(savedInstanceState);
			if(callResumeAfterCreated) {
				onFristResume();
			}
		}
	}
	
	public boolean onKeyDown(int keyCode, KeyEvent keyEvent) {
		return false;
	}
	
	public boolean onKeyUp(int keyCode, KeyEvent keyEvent) {
		return false;
	}
	
	public void fillingHeader(final Context context, ActionBar actionBar) {
	}
	
	/**
	 * 回到顶部
	 */
	public void scrollToTop() {
		
	}
	
	@Override
	public ActionBar getActionBar() {
		return ((BaseActivity)getActivity()).getHeaderBar();
	}
	
	public void initData() {
		setInited(true);
	}
	
	public boolean isInited() {
		return inited;
	}
	public void setInited(boolean inited) {
		this.inited = inited;
	}
	
	@Override
	public void onAttach(Activity activity) {
		super.onAttach(activity);
	}
	
	@Override
	public void onDetach() {
		super.onDetach();
	}
	
	@Override
	public void onDestroy() {
		super.onDestroy();
	}
}
